//
//  YXYWallImageCollectionViewCell.m
//  Topit
//
//  Created by dllo on 15/12/15.
//  Copyright © 2015年 YXY. All rights reserved.
//

#import "YXYWallImageCollectionViewCell.h"

@implementation YXYWallImageCollectionViewCell
- (void)dealloc {
    [_name release];
    [_bio release];
    [_images release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.images = [[UIImageView alloc] initWithFrame:CGRectZero];
        _images.contentMode = UIViewContentModeScaleAspectFill;
        _images.clipsToBounds = YES;
        [self addSubview:_images];
        [_images release];
        
        self.name = [[UILabel alloc] initWithFrame:CGRectZero];
        self.name.font = [UIFont systemFontOfSize:12];
        [self addSubview:self.name];
        [_name release];
        
        self.bio = [[UILabel alloc] initWithFrame:CGRectZero];
        self.bio.font = [UIFont systemFontOfSize:10];
        self.bio.textColor = [UIColor grayColor];
        [self addSubview:self.bio];
        [_bio release];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    _images.frame = CGRectMake(5, 5, self.frame.size.width - 10, self.frame.size.height - 30);
    [self.images nightMode];
    self.name.frame = CGRectMake(self.images.origin.x, self.images.bottom, self.images.width, 10);
    [self.name nightMode];
    self.bio.frame = CGRectMake(self.name.origin.x, self.name.bottom, self.name.width, 10);
    [self.bio nightMode];
}

@end
